﻿@model Answers
@{

}
<div class="mod_discuss clearfix mt10">
    <div class="mod_discuss_face ui_headPort" alt="@Model.User.Id">
        <a href="" class="fl">
        <img src="" width="80" height="80" alt=""></a>
    </div>
    <div class="mod_discuss_cnt">
	    <div class="mod_discuss_cnt_triangle"></div>

        @*<form action="" id="jsaddanswer">*@
        @{Html.BeginForm(null,null,null,FormMethod.Post,new{@id="jsaddanswer"});}
            <input type="hidden" name="qid" id="answerqid" value="@Model.Question.Id">
                <div class="mod_discuss_speak">
				    <div class="mod_edittext">
                        <div class="ask_append">
                        	<div class="ask_append_title">
                                
                            </div>
                            @*<iframe src="" name="iframe_add_answer" width="555" height="100" scrolling="No" frameborder="0" id="iframe_add_answer" style="height: 100px; ">
                            </iframe>*@
							<textarea class="ui_textarea auto_text" id="answertext" name="info">@Model.Answer</textarea>
						</div>
                        <div class="mod_edittext_btn clearfix">
                            <input type="button" class="ui_button fr" id="jsanswersubmit" value="回答" style="">
                            <input type="button" class="fr ui_button_disabled jsformloading" value="回答" style="display: none; ">
                            <p class="mod_edittext_transpond fr">
        @*同时转发到：*@
        @*<label>
            <input name="weibopublish" type="checkbox" flag="0" weibo="weibo" value="1" id="weibopublish" class="vm _jsweibopublis">
            <img id="weiboimg" src="http://static.qyer.com/images/common/tpl/logo_weibo_on.png" class="vm">
        </label>
        <label><input name="qqpublish" type="checkbox" flag="0" notoken="1" weibo="qq" value="1" id="qqpublish" class="vm _jsweibopublis">
            <img id="qqimg" src="http://static.qyer.com/images/common/tpl/logo_qq_off.png" class="vm">
        </label>*@
    </p>
    <!--  
    <p class="mod_edittext_transpond fr">同时转发到：
    <label><input name="" type="checkbox" value="" class="vm" disabled="disabled">
    <img src="http://static.qyer.com/images/common/tpl/logo_weibo_off.png" class="vm"></label>
    <label><input name="" type="checkbox" value="" class="vm" disabled="disabled">
    <img src="http://static.qyer.com/images/common/tpl/logo_qq_off.png" class="vm"></label>
    </p>
    -->
                            <script type="text/javascript">
    $(function () {
        $("._jsweibopublis").change(function () {
            if ($(this).attr("checked") == 'checked') {
               
                var weibo = $(this).attr('weibo');
                var url = $(this).attr('url');
                var id = $(this).attr('id');
                var notoken = $(this).attr('notoken');
                var html = '<div style="width:440px;"><div class="ui_pupBox_head">提示</div><div class="ui_pupBox_content">你还没有绑定我们网站是否现在就绑定？</div><div class="ui_pupBox_foot clearfix"><input notoken="' + notoken + '" weibo="' + weibo + '" type="button" url="http://login.qyer.com/login.php?action=' + weibo + '&bind=1&refer=http://login.qyer.com/login.php?action=close" class="ui_button fr _jsgettoken" value="确定"><a href="javascript:void(0)" class="cBlue fr mr10 _jsclose" flag="' + id + '">取消</a></div></div>';
                //没有绑定的 提示绑定
                if (notoken == 1) {
                    popup.showHtml(html, 440); //提示绑定
                    return;
                }

                //验证已经有token 过期的情况
                if ($(this).attr('flag') == 0) {//设置标记 只是第一次检测

                    //alert(weibo); //发请求验证 token是否失效
                    $.getJSON('/api.php?action=checkweibo&type=' + weibo, function (rs) {
                        //console.log(rs);
                        //alert(rs.result);
                        if (rs.result == 'ok') {//token没有过期

                        } else {//过期
                            var html = '<div style="width:440px;"><div class="ui_pupBox_head">提示</div><div class="ui_pupBox_content">您在我们网站的token已经过期，是否重新授权完成同步？</div><div class="ui_pupBox_foot clearfix"><input notoken="' + notoken + '" weibo="' + weibo + '" type="button" url="http://login.qyer.com/login.php?action=' + weibo + '&bind=1&refer=http://login.qyer.com/login.php?action=close" class="ui_button fr _jsgettoken" value="确定"><a href="javascript:void(0)" class="cBlue fr mr10 _jsclose" flag="' + id + '">取消</a></div></div>';
                            popup.showHtml(html, 440);
                        }
                    });
                    $(this).attr('flag', 1);
                    //alert('yes');
                } else {
                    //alert('no');
                }
            }
        });
        $("._jsclose").live("click", function () {
            var checkbox = $(this).attr('flag');
            $("#" + checkbox).attr("checked", false);
            pupclose();
        });
        $("._jsgettoken").live("click", function () {
            var url = $(this).attr('url');
            var notoken = $(this).attr('notoken');
            //alert(notoken);
            if (notoken == 1) {//新绑定
                var weibo = $(this).attr('weibo');
                //alert(weibo);
                $("#" + weibo + "img").attr('src', "http://static.qyer.com/images/common/tpl/logo_" + weibo + "_on.png");
                $("#" + weibo + "publish").attr('notoken', '0');
            }
            //window.close();770px 630px
            window.open(url, 'newwindow', 'height=770px,width=630px,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
            //window.open(url);
            pupclose();
        });

    });
</script>
                            <span class="jsshowanswerbyte mod_edittext_wordnb" style="display: none; ">0 / 3000 字</span>
                            <span class="icon_error ml10 jsbyteerror" style="display: none; ">超出字数限制</span>
                        </div>
                    </div>
                 </div>
        @{Html.EndForm();}
        @*</form>*@
	</div>
</div>